#ifndef __BSP_485_H__
#define __BSP_485_H__


#include "config.h"
//#include <stdint.h>
#include "hc32_ddl.h"


/** @defgroup BLE_CTRL definition
 * @{
 */
#define BSP_485_TXEN_PORT    (PortD)     /* INPUT */
#define BSP_485_TXEN_PIN     (Pin02)


#define Bsp485TxEnOff()       (PORT_ResetBits(BSP_485_TXEN_PORT, BSP_485_TXEN_PIN))
#define Bsp485TxEnOn()        (PORT_SetBits(BSP_485_TXEN_PORT, BSP_485_TXEN_PIN))
/**
 * @}
 */


/** @defgroup BLE_UART definition
 * @{
 */
/* USART channel definition */
#define BSP_485_USART_CH                         (M4_USART3)
#define BSP_485_USART_CLK                        (PWC_FCG1_PERIPH_USART3)

/* USART baudrate definition */
#define BSP_485_USART_BAUDRATE                   (9600ul)

/* USART RX Port/Pin definition */
#define BSP_485_USART_RX_PORT                    (PortB)
#define BSP_485_USART_RX_PIN                     (Pin06)
#define BSP_485_USART_RX_FUNC                    (Func_Usart3_Rx)

/* USART TX Port/Pin definition */
#define BSP_485_USART_TX_PORT                    (PortB)
#define BSP_485_USART_TX_PIN                     (Pin05)
#define BSP_485_USART_TX_FUNC                    (Func_Usart3_Tx)
#define RS485TxOutHigh()                         (PORT_SetBits(BSP_485_USART_TX_PORT, BSP_485_USART_TX_PIN))

/* USART interrupt number  */
#define BSP_485_USART_EI_NUM                     (INT_USART3_EI)
#define BSP_485_USART_RI_NUM                     (INT_USART3_RI)
#define BSP_485_USART_TI_NUM                     (INT_USART3_TI)
#define BSP_485_USART_TCI_NUM                    (INT_USART3_TCI)
/**
 * @}
 */



void Bsp485Init(void);

void Bsp485UartSet(uint8);

void Bsp485TxOn(void);

#endif

